package game_elements_layer.guys_stuff;
import game_elements_layer.players_stuff.Player;
import game_elements_layer.guys_stuff.guys_actions.GuysActions;
import game_elements_layer.guys_stuff.guys_actions.NotEnoughMoneyException;
import game_elements_layer.field_stuff.locations_stuff.Locations;
import game_elements_layer.field_stuff.locations_stuff.NoContainedProductionFound;
import game_elements_layer.field_stuff.locations_stuff.NotNearblyLocationException;
import game_elements_layer.resourses_stuff.Resources;

/**
 * Created with IntelliJ IDEA.
 * User: vych0914
 * Date: 06.10.14
 * Time: 16:32
 * To change this template use File | Settings | File Templates.
 */
public class Guys {

    Locations currentLocation;
    GuysActions currentGuysAction;
    private int guyNumber;
    private Player guysOwner;

    public Guys(int guyNumber, Player guysOwner) {
        this.currentLocation = null;
        this.currentGuysAction = null;
        this.guyNumber=guyNumber;
        this.guysOwner=guysOwner;
    }


    public GuysActions getCurrentGuysAction() {
        return currentGuysAction;
    }

    public void setCurrentGuysAction(GuysActions currentGuysAction) {
        this.currentGuysAction = currentGuysAction;
    }

    public Locations getCurrentLocation() {
        return currentLocation;
    }

    public void setCurrentLocation(Locations newCurrentLocation) {
        this.currentLocation = newCurrentLocation;
    }

    public Player getGuysOwner() {
        return guysOwner;
    }

    public void moveTo(Locations destination) throws NotNearblyLocationException {
        GuysActions.generateGuysMoveAction(this,destination).perform();
    }

    public void createProduction(int creationTime,int cost,Resources resourceType) throws NotEnoughMoneyException {
        GuysActions.generateGuysCreateProductionAction(this,creationTime,cost,resourceType).perform();
    }

    public void gatherResources() throws NoContainedProductionFound {
        GuysActions.generateGuysGatherResourcesAction(this).perform();
    }

    @Override
    public String toString() {
        return "Guy #" + guyNumber + "( guysOwner is " + guysOwner+ ")";
    }
}
